
SRC = $(wildcard *.c)  
OBJ = $(patsubst %.c,%.o,$(SRC))
CFLAGS = -c -W
CC = gcc


app: start $(OBJ)
#	$(CC) $^ -o $@
	$(CC) $(OBJ) -o $@
	@echo "\n***   Compile project   ***\n"

%.o: %.c
	$(CC) $< $(CFLAGS) -o $@

start:
	-clear
	@echo "\n***  Compiling project  ***\n"


clean:
	-clear
	@echo "\n***  cleanning project  ***\n"
	-rm app
	-rm *.o
	@echo "\n***   clean completed   ***\n"


PRONAME = gobang_v3.0_moc
BPDIR = gobang_v3.0_moc
TARNAME = $(PRONAME)_`date +%Y``date +%m``date +%d`-`date +%H``date +%M``date +%S`_bp


bakup:
	-clear
	@echo "\n***  backuping project  ***\n"
	-mkdir ~/backup/$(BPDIR)
	-cp -a ./* ~/backup/$(BPDIR)
	-mv ~/backup/$(BPDIR) ./
	@tar czvf $(TARNAME).tar.gz $(BPDIR)
	-mv ./*.tar.gz ~/backup
	-rm -rf ./$(BPDIR)
	@echo "\n***  backup completed   ***\n"

.PHONY: start clean bakup

